import { ref, Ref } from 'vue'
import { PlatformFrameState } from 'qiankun-frame'
import { qiankunApp } from '@/qiankun/qiankun-app'

const adminInfo = ref<PlatformFrameState>(qiankunApp.active ? qiankunApp.state : ({} as PlatformFrameState))
qiankunApp.onStateChange(data => {
  console.log('app-vue3 stateChange', data)
  adminInfo.value = data
})

export function useAdminInfo() {
  return {
    adminInfo: adminInfo as Ref<PlatformFrameState>,
  }
}

/**
 * 登出后处理
 */
export const afterLogout = () => {}
